﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ include file="/pub/includ.jsp"%>
<%
	String userId = (String)request.getSession().getAttribute(com.wing.common.Constants.SESSION_USER_ID); 

%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
<!--
	body {
		font: 11px Arial, Helvetica, sans-serif;
		background: #ffffff url(<%=imgPath %>/index/bg2.jpg);
		padding: 0;
		margin: 0;
	}
    ul#navigation {
	    position: fixed;
	    margin: 0px;
	    padding: 0px;
	    top: 0px;
	    right: 10px;
	    list-style: none;
	    z-index:99;
	    width:721px;
	}
	ul#navigation li {
	    width: 103px;
	    display:inline;
	    float:left;    
	}
	ul#navigation li a {
	    display: block;
	    float:left;
	    margin-top: -2px;
	    width: 100px;
	    height: 25px;
	    background-color:#E7F2F9;
	    background-repeat:no-repeat;
	    background-position:50% 10px;
	    border:1px solid #BDDCEF;
	    -moz-border-radius:0px 0px 10px 10px;
	    -webkit-border-bottom-right-radius: 10px;
	    -webkit-border-bottom-left-radius: 10px;
	    -khtml-border-bottom-right-radius: 10px;
	    -khtml-border-bottom-left-radius: 10px;
	    text-decoration:none;
	    text-align:center;
	    padding-top:80px;
	    opacity: 0.7;
	    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=70);  
	}
	ul#navigation li a:hover{
	     background-color:#CAE3F2;
	}
	ul#navigation li a span{
	    letter-spacing:2px;
	    font-size:11px;
	    color:#60ACD8;
	    text-shadow: 0 -1px 1px #fff;      
	}
	ul#navigation .home a{
	    background-image: url(<%=imgPath %>/index/home.png);
	}
	ul#navigation .about a      {
	    background-image: url(<%=imgPath %>/index/id_card.png);
	}
	ul#navigation .search1 a      {
	    background-image: url(<%=imgPath %>/index/search.png);
	}
	ul#navigation .podcasts a      {
	    background-image: url(<%=imgPath %>/index/ipod.png);
	}
	ul#navigation .rssfeed a   {
	    background-image: url(<%=imgPath %>/index/rss.png);
	}
	ul#navigation .photos a     {
	    background-image: url(<%=imgPath %>/index/camera.png);
	}
	ul#navigation .contact a    {
	    background-image: url(<%=imgPath %>/index/mail.png);
	}
	ul.selectable li {
	    width: 150px;
	    display:inline;
	    float:left;   
	}
	ul.selectable li a {
	    display: block;
	    float:left;
	    margin-top: -2px;
	    width: 150px;
	    height: 25px;
	    background-color:#668EFA;
	    background-repeat:no-repeat;
	    background-position:50% 10px;
	    border:1px solid #BDDCEF;
	    text-align:center;
	    padding-top:10px;
	    
	}
	ul.selectable li a:hover{
		text-decoration: none;
	    background-color:#CAE3F2;
	    color:#fff;
	}
	.siteschange12 {  
		color: #FF0000;
		display: block;
		margin:5px 5px auto;
		width:150px;height:25px;
		background-color:#668EFA;
		border:1px solid #BDDCEF;
		text-align:center;padding-top:5px;
	}
	a.siteschange12:link {  color: #FF0000}
	a.siteschange12:visited {  color: #FF0000}
	a.siteschange12:hover {  text-decoration: none;font-size: 12px; color: #0000FF}
-->
</style>
<title></title>
</head>
<body style="overflow: hidden">
	<div style="width:300px">
		<div style="position: absolute;float: left">
			<a href="#" onclick="ochangesite();" style="font-size:20px;font-weight:bold;" id="sitename" class="siteschange12" ></a>
			<div  id="changesitediv" style="width:152px;margin:3px 5px auto;position: absolute;display: none;float: left">
				<ul id="selectable" class="selectable">
				</ul>
			</div>
		</div>
		<div style="float: right">
			<a href="#" onclick="osysmgr();" id="sysmgra" class="siteschange12" style="width:60px;" >系统管理</a>
			<div  id="sysmgrdiv" style="width:152px;margin:3px 5px auto;position: absolute;display: none;">
				<ul id="sysmgrul" class="selectable">
			  		<li><a onclick="openDialog('yhgldiv','/sys/user','用户管理');" href="#">用户管理</a></li> 
			  		<li><a onclick="openDialog('jsgldiv','/sys/role','角色管理');" href="#">角色管理</a></li> 
			  		<li><a onclick="openDialog('mkgldiv','/sys/module','模块管理');" href="#">模块管理</a></li> 
			  		<li><a onclick="openDialog('rzgldiv','/sys/operatelog','日志管理');" href="#">日志管理</a></li> 
			  		<li><a onclick="openDialog('bmgldiv','/sys/code','编码管理');" href="#">编码管理</a></li> 
				</ul>
			</div>
		</div>
	</div>
	
	
    <ul id="navigation">
    <%if(com.wing.common.Constants.SYSTEM_SUPERADMIN_ID.equals(userId)){ %>
	  <li class="home"><a onclick="openDialog('zdgldiv','/cms/site','站点管理');" href="#"><span>站点管理</span></a></li>
	<%} %> 
	  <li class="about"><a onclick="openDialog('pdgldiv','/cms/channel','频道管理');" href="#"><span>频道管理</span></a></li> 
	  <li class="search1"><a onclick="openDialog('wzzgldiv','/cms/artgroup','文章组管理');" href="#"><span>文章组管理</span></a></li>
	  <li class="photos"><a onclick="openDialog('wzgldiv','/cms/article','文章管理');" href="#"><span>文章管理</span></a></li> 
	  <li class="rssfeed"><a onclick="openDialog('kjgldiv','/cms/layout','框架管理');" href="#"><span>框架管理</span></a></li> 
	  <li class="podcasts"><a onclick="openDialog('mbgldiv','/cms/template','模板管理');" href="#"><span>模板管理</span></a></li>  
	  <li class="contact"><a onclick="openDialog('pfgldiv','/cms/lookfeel','皮肤管理');" href="#"><span>皮肤管理</span></a></li>
	</ul>
	<script type="text/javascript">
		$(document).ready(
			function()
			{
				initsites();
				var d=300;
                $('#navigation a').each(function(){
                    $(this).stop().animate({
                        'marginTop':'-80px'
                    },d+=150);
                });

                $('#navigation > li').hover(
	                function () {
	                    $('a',$(this)).stop().animate({
	                        'marginTop':'-2px'
	                    },200);
	                },
	                function () {
	                    $('a',$(this)).stop().animate({
	                        'marginTop':'-80px'
	                    },200);
	                }
	            );     
			}
		);
		function osysmgr() {
			var options = {};
			$( "#sysmgrdiv" ).toggle( "blind", options, 500);
		};
		function csysmgr() {
			var options = {};
			$( "#sysmgrdiv" ).hide( "blind", options, 500);
		};
		function ochangesite() {
			var options = {};
			$( "#changesitediv" ).toggle( "blind", options, 500);
		};
		function cchangesite() {
			var options = {};
			$( "#changesitediv" ).hide( "blind", options, 500);
		};
		function changesite(siteId,siteName) {
			var url = "<%=path %>/cms/site/changesite";
			$.ajax({
			   type: "POST",
			   url: url,
			   data: "siteId="+siteId+"&siteName="+siteName,
			   success: function(rows){
			   		$("#sitename").text("当前站点-"+siteName);
				    cchangesite();  
			   }
			});
			
		};
		
		function openDialog(id,url,title){
			var container = $( "p" );
			
			$('<div id="'+id+'" ><iframe width="100%" src="'+url+'" allowTransparency="true" height="100%"></iframe></div>')
		        .appendTo("body").AeroWindow({
	            WindowTitle:          '<font color="white"><b>'+title+'</b></font>',
	            WindowPositionTop:    'center',
	            WindowPositionLeft:   'center',
	            WindowWidth:          550,
	            WindowHeight:         300,
	            WindowAnimationSpeed: 1000,
	            WindowAnimation:      'easeOutCubic',
	            WindowResizable:      true,
	            WindowDraggable:      true,
	            WindowMinimize:       true,
	            WindowMaximize:       true,
	            WindowStatus:         'maximized', 
	            WindowClosable:       true
	          });
		}
		function initsites(){
			var url = "<%=path %>/cms/site/getsites";
			$.ajax({
			   type: "POST",
			   url: url,
			   data: "",
			   success: function(rows){
				    var siteId="";
				    var siteName="";
				    $.each(rows, function(i, n){
				    	if(i==0){
				    		siteId=n.id;
				    		siteName=n.site_name;
				    	}
			   	        $("<li onclick=\"changesite('"+n.id+"','"+n.site_name+"')\" title=\""+n.site_name+"\"><a>"+n.site_name+"</a></li>").appendTo("#selectable");
			        });  
			        <%if(request.getSession().getAttribute(com.wing.common.Constants.SESSION_SITE_ID)!=null){%>
						changesite("<%=request.getSession().getAttribute(com.wing.common.Constants.SESSION_SITE_ID) %>","<%=request.getSession().getAttribute(com.wing.common.Constants.SESSION_SITE_NAME) %>");
					<%}else{%>
						if(siteId!=""){
							changesite(siteId,siteName);
						}
					<%}%> 
			   }
			});
		}
		
		/**
		*	弹出顶层窗口
		*	data 为JSON串 其属性有：
		*		src			弹出窗口链接
		*		title		标题
		*		width		弹出窗口的宽度
		*		height		弹出窗口的高度
		*		position	弹出位置
		*		savefunc	点击保存时调用的方法，如果方法返回“success”则关闭
		*		closefunc	点击关闭时调用的方法，如果方法返回“success”则关闭
		*	windowWork 调用该方法所在的window
		*	params 参数数组，传入回调函数中
		*/
		function calltopdailog(data,windowWork,params){
			var jsonObject = eval("("+data+")");
			var src = jsonObject.src;
			var title = jsonObject.title;
			var position = "center";
			if(jsonObject.position){
				position = jsonObject.position;
			}
			var width=800;
			if(jsonObject.width){
				width = jsonObject.width;
			}
			var height=600;
			if(jsonObject.height){
				height = jsonObject.height;
			}
			var closefunc=jsonObject.closefunc;
			var savefunc=jsonObject.savefunc;
			$('<iframe scrolling="no" src="'+src+'"/>').dialog({
	                title: title,
	                autoOpen: true,
	                width: width,
	                height: height,
	                modal: true,
		            position:position,
		            buttons: {
						"保存": function() {
							if(savefunc){
								if(windowWork.eval(savefunc)(this,params)=="success"){
									$( this ).dialog( "close" );
								}
							}else{
								$( this ).dialog( "close" );
							}
						},
						"关闭": function() {
							if(closefunc){
								if(windowWork.eval(closefunc)(this,params)=="success"){
									$( this ).dialog( "close" );
								}
							}else{
								$( this ).dialog( "close" );
							}
						}
					}  
	            }).width(width-30).height(height-30);
		}
	</script>
</body>
</html>
